package cn.lili.controller.member;

import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.entity.dos.MemberEvaluationThumbs;
import cn.lili.modules.member.entity.dto.EvaluationThumbsParams;
import cn.lili.modules.member.service.MemberEvaluationThumbsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 买家端，会员商品评价赞成接口
 *
 * @author moxingjian
 * @version 1.0
 * @date 2023-12-05 14:48
 * <p>
 * 版本更新：
 * 更新版本号    更新人      更新时间      更新内容
 */
@RestController
@Api(tags = "买家端,会员商品评价接口")
@RequestMapping("/buyer/member/evaluation-thumbs")
public class MemberEvaluationThumbsBuyerController {

    @Resource
    private MemberEvaluationThumbsService evaluationThumbsService;


    @ApiOperation(value = "查询点赞或支持的记录")
    @ApiImplicitParam(name = "evaluationThumbsParams", value = "查询参数", required = true, dataType = "EvaluationThumbsParams", paramType = "query")
    @GetMapping(value = "/parameter")
    public ResultMessage<List<MemberEvaluationThumbs>> listByParameter(EvaluationThumbsParams evaluationThumbsParams) {
        // 设置当前登录ID
        evaluationThumbsParams.setMemberId(UserContext.getCurrentUser().getId());
        return ResultUtil.data(evaluationThumbsService.listByParameter(evaluationThumbsParams));
    }
}
